﻿using System;
using System.Windows;
using System.Windows.Resources;
using Avivo.Common;

namespace Avivo.Tools.Sprite
{
	internal static class Settings
	{
		//Assembly short name
		public const string Name = "xsprite";

		public static bool Verbose
		{
			get;
			set;
		}

		private static string appBasePath;
		public static string AppBasePath
		{
			get
			{
				return AppDomain.CurrentDomain.BaseDirectory;
			}
		}

		/// <summary>
		/// Gets a help message from a resource file.
		/// </summary>
		public static string HelpMessage
		{
			get
			{
				string uri = "/" + Settings.Name + ";component/Resources/Help.txt";
				StreamResourceInfo info = Application.GetResourceStream(new Uri(uri, UriKind.Relative));
				string message = Utils.ReadStream(info.Stream);
				return message.Replace("$0", Settings.Name);
			}
		}

		/// <summary>
		/// Gets a syntax error message from a resource file.
		/// </summary>
		public static string SyntaxError
		{
			get
			{
				string uri = "/" + Settings.Name + ";component/Resources/Error.txt";
				StreamResourceInfo info = Application.GetResourceStream(new Uri(uri, UriKind.Relative));
				string message = Utils.ReadStream(info.Stream);
				return message.Replace("$0", Settings.Name);
			}
		}
	}
}
